package com.distributer.policy.request;

import com.distributer.policy.model.InsurancePolicy;
import com.distributer.policy.service.InsurancePolicyService;

public class PolicyRefreshRequest implements Request{

	private InsurancePolicyService insurancePolicyService;
	
	private String jbPolicyNo;
	
	public PolicyRefreshRequest(InsurancePolicyService insurancePolicyService,String jbPolicyNo){
		this.insurancePolicyService = insurancePolicyService;
		this.jbPolicyNo = jbPolicyNo;
	}
	
	@Override
	public void prosess() {
		//查询数据库中的保单信息
		InsurancePolicy insurancePolicyFromDB = insurancePolicyService.findInrancePolicyFromCacheByJbPolicyNo(getJbPolicyNo());
		//刷新到缓存中
		if (insurancePolicyFromDB != null) {
			insurancePolicyService.refreshInsrancePolicyCache(insurancePolicyFromDB);
		}
	}

	@Override
	public String getJbPolicyNo() {
		return this.jbPolicyNo;
	}

	
}
